package com.student.demo.config;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

//�ļ��ϴ�����
public class BasicController {

	public static class WenPackage{
		private Integer statues;
		
		private String message;
		
		private Object data;

		public Integer getStatues() {
			return statues;
		}

		public void setStatues(Integer statues) {
			this.statues = statues;
		}

		public String getMessage() {
			return message;
		}

		public void setMessage(String message) {
			this.message = message;
		}

		public Object getData() {
			return data;
		}

		public void setData(Object data) {
			this.data = data;
		}

		public WenPackage(Integer statues, String message, Object data) {
			super();
			this.statues = statues;
			this.message = message;
			this.data = data;
		}
		
		
	}
	protected void uploadFile(byte[] file, String filePath, String fileName) throws IOException {
		File targetFile = new File(filePath);  
       if(!targetFile.exists()){    
            targetFile.mkdirs();    
        }       
        FileOutputStream out = new FileOutputStream(filePath+fileName);
        out.write(file);
        out.flush();
        out.close();		
}
	protected WenPackage success(Object data) {
		return new WenPackage(200, "success", data);
	}
}
